<!--
 * @Author: your name
 * @Date: 2022-04-27 09:38:50
 * @LastEditTime: 2022-09-19 15:18:17
 * @LastEditors: wangwang 2723008256@qq.com
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \jzjy\src\views\ProductCenter\index.vue
-->
<template>
  <div id="container">
   
   
    <!-- 在线课程 -->
    <div class="classOnline">
      <div class="title2">
        <!-- <span></span> -->
        <h3>在线课程</h3>
      </div>
      <div class="classBox">
        <div
          class="box"
          v-for="item in courselist"
          :key="item.id"
          @click="productDetails(item.id,item.type_id)"
        >
          <img :src="item.file_url" />
          <div class="activename">{{ item.title }}</div>
          <p>{{ item.author }}</p>
        </div>
      </div>
    </div>
    
  </div>
</template>

<script>
import { banner, productinfo } from "../../api/http.js";
export default {
  components: {},
  data() {
    return {
      courselist: [], //在线课程列表
      nothingShow: false, //空图展示
      boxLeft: 0, //图片滚动距离
      is_jtxly: 0, //是否为精听训练营
    };
  },
  created() {
    //回到顶部
    $(document).ready(function () {
      $(window).scrollTop(0);
    });
    
    //产品首页中心
    productinfo({
      md5key: localStorage.getItem("md5key"),
      type_id: 1, //默认产品分类为高中语文
    }).then((res) => {
      if (res.retInt == 1) {
        console.log(res, "产品首页中心");
        const data = res.retRes;
        this.courselist = data.courselist; //在线课程
      } else {
        this.$message.error(res.retErr);
      }
    });
  },
  methods: {
    // 前往在线课程
    goCol(id) {
      this.$router.push({
        name: "ClassOnline",
        query: {
          id: id,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
#container {
  width: 100%;
  background-color: #f0f2f5;
  .title {
    padding-bottom: 20px;
    font-size: 24px;
    color: #333;
    text-align: left;
    font-weight: 600;
    // font-family: Microsoft YaHei;
    border-bottom: 1px solid #ccc;
  }
  .title2 {
    display: flex;
    margin-top: 20px;
    span {
      display: inline-block;
      position: relative;
      top: 5px;
      width: 4px;
      height: 20px;
      background: #08a579;
      border-radius: 2px;
    }
    h3 {
      margin-left: 20px;
      font-size: 24px;
      // font-family: Microsoft YaHei;
      font-weight: 600;
      color: #333333;
    }
  }
  .classOnline {
    margin: 20px auto;
    width: 1200px;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    .classBox {
      display: flex;
      flex-wrap: wrap;
      margin: 20px 0;
      margin-left: 20px;
      .box {
        margin-right: 20px;
        margin-bottom: 35px;
        width: 275px;
        background-color: #fff;
        border-radius: 10px;
        cursor: pointer;
        img {
          margin-bottom: 10px;
          width: 275px;
          height: 159px;
          border-radius: 10px;
        }
        .activename {
          margin-bottom: 18px;
          width: 280px;
          font-size: 14px;
          font-family: Microsoft YaHei;
          color: #333333;
        }
        p {
          font-size: 12px;
          color: #939599;
        }
      }
    }
    .box:hover {
      img {
        transition: 0.8s;
        // position: relative;
        // top: -10px;
        transform: translateY(-10px);
        box-shadow: 0px 2px 10px 2px #dedede;
      }
      .activename {
        color: #08a579;
      }
    }
    // .bookBox::after {
    //   content: "";
    //   width: 370px;
    // }
  }
}
</style>
